package train

import (
	"gin-base/base/config"
	"gin-base/base/db"
	"github.com/jinzhu/gorm"
)

type RecordRange struct {
	RecordId        uint
	Restore         int
	Burning         int
	Cardiopulmonary int
	Endurance       int
	Anaerobic       int
	gorm.Model
}

func (RecordRange) TableName() string {
	return config.Ini.String("mysql.table_prefix") + "train_record_range"
}

func (this *RecordRange) Save() bool {
	db := db.Open()
	defer db.Close()

	db.Create(&this)

	return !db.NewRecord(this)
}
